﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Data.Entity.Migrations;
using _1._7._2015_EF_Practice.Data.Model; 

namespace _1._7._2015_EF_Practice.Data
{
    public static class Seeder
    {
        public static void Seed(InvoicesDbContext context)
        {
            //context.Invoices.AddOrUpdate( i => new {i.Description, i.InvoiceId, i.OrderDate, i.TotalCost},
            //    new Invoice { Description = "afasd",  },
            
            //);

            Invoice invoice = new Invoice()
            {
                Description = "Thing",
                OrderDate = DateTime.Now,
                TotalCost = 3.9m
            };
            context.Invoices.AddOrUpdate(i => i.Description, invoice);
            Invoice invoice2 = new Invoice()
            {
                Description = "Thing2",
                OrderDate = DateTime.Now,
                TotalCost = 4.9m
            };
            context.Invoices.AddOrUpdate(i => i.Description, invoice2);
            Invoice invoice3 = new Invoice()
            {
                Description = "Thing3",
                OrderDate = DateTime.Now,
                TotalCost = 5.9m
            };
            context.Invoices.AddOrUpdate(i => i.Description, invoice3);

            context.SaveChanges();

        }
    }
}
